home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / ctldlt.zip / USEDTL.CPP < prev    next >
C/C++ Source or Header  |  1992-09-09  |  3KB  |  63 lines

  1. #include <owl.h>               // Program to display a dialog box
  2. #include <dialog.h>            // With a Blue Rectangle in it and
  3. #include <static.h>            // a Button that when pressed displays
  4. #include <bwcc.h>              // a second blue rectangle
  5. #include "ctldtl.h"          // Digital display custom control
  6. #include "ctlcol.h"          // Colored Rectangle custom control
  7. #include "usedtl.h"
  8.  
  9. class TMyDialog : public TDialog          // Dialog class to add
  10.   {                                       // processing for
  11.   private:                                // button selections
  12.     PTDigital pDigital;
  13.   public:
  14.     TMyDialog(PTWindowsObject AParent,LPSTR lpName)// constructor calls
  15.       :TDialog(AParent,lpName)
  16.       {
  17.       BWCCGetVersion();                   // Forces DLLs to load
  18.       CTLDTLGetVersion();
  19.       CTLCOLGetVersion();
  20.       };
  21.     virtual void HandleButtonMessage(RTMessage Msg) // button handler
  22.       = [ID_FIRST + IDB_CREATE];
  23.   };
  24. void TMyDialog:: HandleButtonMessage(RTMessage)
  25.   {
  26.   MessageBeep(0);
  27.   pDigital = new TDigital(this,201,100,100,120,32,
  28.              (LPSTR)"$50.96~0~0~255~",17);
  29.   GetApplication()->MakeWindow(pDigital);
  30.   InvalidateRect(HWindow,NULL,FALSE);
  31.   }
  32. class TMyApp : public TApplication        // Application Class to contain
  33.   {                                       // the application
  34.   public:
  35.     TMyApp(LPSTR lpName, HINSTANCE hInstance,  // constructor calls the
  36.         HINSTANCE hPrevInstance,       // base class constructor
  37.         LPSTR lpCmdLine, int nCmdShow)
  38.         :TApplication(lpName, hInstance,
  39.                   hPrevInstance,
  40.                   lpCmdLine, nCmdShow) {};
  41.  
  42.     virtual void InitMainWindow(); // overrides base class InitMainWindow
  43.   };
  44.  
  45. void TMyApp::InitMainWindow()      // to initialize a dialog box
  46.   {                                // as the main window
  47.   MainWindow = new TMyDialog(NULL,"Main_Window_Dialog");
  48.   }                                // using message processing provided
  49.                    // by derived class
  50.  
  51. int PASCAL WinMain(HINSTANCE hInstance,         // main entry point from
  52.            HINSTANCE hPrevInstance,     // windows to this program
  53.            LPSTR lpCmdLine,
  54.            int nCmdShow)
  55.   {
  56.   TMyApp Program("Dialog Tester",hInstance,  // create instance of
  57.                hPrevInstance,        // the dialog application
  58.                lpCmdLine,nCmdShow);
  59.   Program.Run();                                  // run it
  60.   return (Program.Status);                        // exit
  61.   }
  62. /**********************************************************************/
  63.